<template>
  <view class="goodsItem" @click="goPage(`/pages/goodsDetails/goodsDetails?goodId=${info.goodId}&goodType=0`)">
    <image :src="info.picurl" mode="scaleToFill" />
    <view class="rightBox">
      <view>
        <view class="title">
          <view>{{ info?.FName || "" }} </view>
          <view class="rightTitle" v-if="isDetails">
            溯源
            <u-icon color="#21CCA2" name="arrow-right"></u-icon>
          </view>
          <slot name="start"></slot>
        </view>
        <!-- <view class="subTitle">
          {{ info?.description || "1231231" }}
        </view> -->
        <slot name="remark"></slot>
      </view>
      <view class="subTitle" style="width: 90%" v-if="isDetails">
        <view>下单数量：<text style="color: #595959">2</text></view>
        <view>出库数量：<text style="color: #595959">2</text></view>
      </view>
      <view class="btn" v-else>
        <view class="priceBox">
          <view class="price"><text>￥</text>{{ info?.price || "0" }}</view>
        </view>
        <u-icon v-if="isCollect" name="star-fill" color="#21CCA2" size="22"></u-icon>
        <u-number-box v-else bgColor="#fff" button-size="10" :min="0" :max="100" iconStyle="border:1px solid #F7F7F7;" v-model="info.count"></u-number-box>
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { goPage } from "../utils/commonFn";
const { info, isCollect } = defineProps<{
  info: any;
  isCollect?: boolean;
  isDetails?: boolean;
}>();
const count = ref(0);
</script>

<style lang="less" scoped>
.goodsItem {
  width: 100%;
  display: flex;
  background: #fff;
  margin-bottom: 20rpx;
  image {
    width: 170rpx;
    height: 170rpx;
    border-radius: 10px;
    margin-right: 32rpx;
    background: #f35555;
  }

  .rightBox {
    width: calc(100% - 200rpx);
    display: flex;
    flex-direction: column;
    height: 170rpx;
    justify-content: space-between;
    .title {
      display: flex;
      justify-content: space-between;
      font-size: 32rpx;
      font-weight: 500;
      color: #333333;
      .rightTitle {
        font-size: 26rpx;
        color: #21cca2;
        width: 90rpx;
        display: flex;
        align-items: center;
      }
    }
    .subTitle {
      display: flex;
      justify-content: space-between;
      font-size: 28rpx;
      color: #a8a8a8;
      line-height: 34rpx;
      margin-top: 10rpx;
    }

    .btn {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      .priceBox {
        display: flex;
        align-items: center;
        margin-right: 20rpx;
        .price {
          font-size: 40rpx;
          font-weight: 500;
          color: #f35555;
          line-height: 30rpx;
          text {
            font-size: 20rpx;
          }
        }
      }
    }
  }
}
</style>
